Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: OpenDoc Class Reference /
Part 1 - Classes and Methods / ODTranslation


Translate

The Translate method tries to translate the specified source data to the specified value type.

ODTranslateResult Translate (in ODValueType fromType,
                             in ODByteArray fromData, 
                             in ODValueType toType,
                             out ODByteArray toData);
fromType
The type of the source data to be translated.
fromData
A byte array whose buffer contains the source data to be translated.
toType
The type to which the source data is to be translated.
toData
A byte array whose buffer is to contain the translated data.
return value
The result of the translation. The return value is one of the following: kODCanTranslate or kODCannotTranslate.
DISCUSSION
The return value kODCanTranslate indicates that translation is allowed with the specified type. The return value kODCannotTranslate indicates that translation is not allowed with the specified type.

Your part calls this method after calling the CanTranslate method to establish that the source type is translatable. This method does not change the content of the source byte array.

If translation is successful, this method allocates the destination byte array structure and its buffer, and stores the translated data in that buffer. It is your responsibility to deallocate the byte array structure (and its buffer) when it is no longer needed.

EXCEPTIONS
kODErrNoSysTranslationFacility
The underlying system translation facility is not present.
kODErrOutOfMemory
There is not enough memory to allocate the destination byte array structure (or its buffer).
This method may throw platform-specific exceptions.

SEE ALSO
The ODByteArray type (page 877).
The ODTranslateResult type (page 920).
The ODValueType type (page 904).
The ODTranslation::CanTranslate method (page 790).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help